<?php
namespace Admin\Model;
use Think\Model;
/**
 * 幻灯片模型
 */
 class WxnavigationModel extends  Model{
 	
	public $_validate = array();
 	/**
	 * 幻灯片添加方法
	 */
	 public function addNav(){
		$this->_validate =array(
			array('wxnname','require','菜单名称不能为空'),
		);
		if(!$this->create()){
			return false;
		}
		$data = $_POST;
		$data['wxnuid'] = $_SESSION['uid'];
		return M('wxnavigation')->add($data);

			
	 }
	 
	 
	 /**
	  * 修改
	  */
	 public function editNav(){
	 	$nid = I('get.nid');
		$this->_validate =array(
			array('nname','require','菜单名称不能为空'),
		);
		if(!$this->create()){
			return false;
		}
		$data = $_POST;
		$data['wxnuid'] = $_SESSION['uid'];
		M('wxnavigation')->where("id='{$nid}'")->save($data);
		return true;
			
	 }
	 
	 /**
	  * 删除方法栏目
	  */
	public function del(){
		$id = I('get.id');
		M("wxnavigation")->where("id = '{$id}'")->delete();
		return true;
	}

 }
